package com.spring.demo.repository;/**
 * Created by liujun on 2018/6/1.
 */

import com.spring.demo.vo.UserVo;

import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author Administrator
 * @create 2018-06-01 16:50
 */
@Repository
public class UserRepositoryImpl implements UserRepository {
    @Override
    public List<UserVo> findAll() {
        return userVos;
    }

    private static List<UserVo> userVos = new ArrayList<>();

    public UserRepositoryImpl() {
        initData();
    }

    private void initData() {
        UserVo uv1 = new UserVo();
        uv1.setId(1);
        uv1.setName("aaa");
        uv1.setBirthDay(new Date());

        UserVo uv2 = new UserVo();
        uv2.setId(2);
        uv2.setName("bbb");
        uv2.setBirthDay(new Date());

        UserVo uv3 = new UserVo();
        uv3.setId(3);
        uv3.setName("ccc");
        uv3.setBirthDay(new Date());

        UserVo uv4 = new UserVo();
        uv4.setId(4);
        uv4.setName("ddd");
        uv4.setBirthDay(new Date());

        userVos.add(uv1);
        userVos.add(uv2);
        userVos.add(uv3);
        userVos.add(uv4);

    }
}
